const config = require('../../../config/config.local');
const amazonMws = require('amazon-mws')(config.AWSAccessKeyId, config.AWSSecretKey);
const isProduction = process.env.NODE_ENV === 'production';

const getLastUpdatedTimeForRecommendations = {};
getLastUpdatedTimeForRecommendations.generateOption = function(seller_id, mws_auth_token, marketplaceId, categoryQueryList){
  const baseOption = {
    'Version': '2013-04-01',
    'Action': 'GetLastUpdatedTimeForRecommendations',
    'SellerId': seller_id,
    'MWSAuthToken': mws_auth_token,
    'MarketplaceId': marketplaceId,
  };

  return baseOption;
};

getLastUpdatedTimeForRecommendations._ = function(options) {
  if (!isProduction) {
    return amazonMws.recommendations.searchFor(options);
  } else {
    console.error("bot not implemented!")
  }
};

getLastUpdatedTimeForRecommendations.getLastUpdatedTimeForRecommendations = function(seller_id, mws_auth_token, marketplaceId) {
  return this._(this.generateOption(seller_id, mws_auth_token, marketplaceId));
};


module.exports = getLastUpdatedTimeForRecommendations;